package org.easy.byteaidraw;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;


@Configuration
@EnableConfigurationProperties({ByteAiDrawProperties.class})
@ConditionalOnProperty(prefix = ByteAiDrawProperties.PREFIX, name = "enabled", havingValue = "true")
public class ByteAiDrawAutoConfiguration {

    @Resource
    private ByteAiDrawProperties byteAiDrawProperties;

    @Bean
    public ByteAiDrawTemplate byteAiDrawTemplate() {
        ByteAiDrawClient byteAiDrawClient = new ByteAiDrawClient(byteAiDrawProperties.getAccessKey(),
                byteAiDrawProperties.getSecretKey(),
                byteAiDrawProperties.getQps(),
                byteAiDrawProperties.getQps(),
                byteAiDrawProperties.getQps()
        );
        return new ByteAiDrawTemplate(byteAiDrawClient);
    }

    public static void main(String[] args) {
        String accessKey = "AKLTYzJlZmJkYzFlMDhlNGQ1YzllZjEyMjQwYjZmNTllY2M";
        String secretKey = "T1dSaVlUQTVOV0k1Wm1WaE5EQmxaV0V6TnpKak5HRXlNekppWW1JMVlXSQ==";

        ByteAiDrawClient byteAiClient = new ByteAiDrawClient(accessKey, secretKey, 1, 1, 1);
        ByteAiDrawTemplate byteAiTemplate = new ByteAiDrawTemplate(byteAiClient);


        String string = byteAiTemplate.byteedit_v2_0("头发变成红色",
                "https://url .jpg",
                0.5f);

        System.out.println("人像保持结果 " + string);
    }



}
